package domain

import (
	"context"
	"go.mongodb.org/mongo-driver/bson/primitive"
	"time"
)

const (
	CollectionCounter = "ms_counter"
)

type Counter struct {
	ID       primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	Module   string             `bson:"module" json:"module"`
	Counter  uint64             `bson:"counter" json:"counter"`
	UpdateAt time.Time          `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
	CreateAt time.Time          `bson:"createAt,omitempty" json:"createAt,omitempty"`
}

type CounterRepository interface {
	NextCounterValue(c context.Context, module string) (uint64, error)
	NextCounterValueS(c context.Context, module string) error
}
